package com.yhb.channel.impl.SXY.ResponseParser.impl;

import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class AsyncRemitResponse extends RemitResponse {
    /**
     * 如果订单如果还没完成 不扭转状态 忽略此次回调 否则通知业务
     * @return 订单是否完成
     */
    public boolean isDone() {
        boolean orderIsDone = OrderStatus.SUCCESS.equals(this.getOrderStatus());
        return Status.SUCCESS.equals(this.getStatus()) && orderIsDone;
    }

    /**
     * 订单失败了要通知业务
     * @return 订单是否失败
     */
    public boolean isFail() {
        return !Status.SUCCESS.equals(this.getStatus()) ||
                (
                        OrderStatus.FAILED.equals(this.getOrderStatus()) ||
                                OrderStatus.FAIL.equals(this.getOrderStatus())
                );
    }
}
